package com.example.demo.niuke;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @Description: 华为机考-坐标移动
 * @Author: LLL
 * @Date: 2020-03-21 12:57
 **/
public class Main12 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        String[] arr = str.split(";");
        int x = 0, y = 0;
        for (String s : arr) {
            if (isRight(s)) {
                if (s.contains("A")) {
                    x -= Integer.parseInt(s.substring(1));
                }
                if (s.contains("D")) {
                    x += Integer.parseInt(s.substring(1));
                }
                if (s.contains("W")) {
                    y += Integer.parseInt(s.substring(1));
                }
                if (s.contains("S")) {
                    y -= Integer.parseInt(s.substring(1));
                }
            }
        }
        System.out.println(x + "," + y);

    }

    private static boolean isRight(String s) {
        if (s.equals("") || s.length() == 1 || s.length() > 3) {
            return false;
        }
        if (s.contains("W") || s.contains("A") || s.contains("S") || s.contains("D")) {
            if (s.charAt(0) == 'W' || s.charAt(0) == 'A' || s.charAt(0) == 'S' || s.charAt(0) == 'D') {
                try {
                    Integer.parseInt(s.substring(1));
                    return true;
                } catch (Exception e) {
                    return false;
                }
            }
        }
        return false;
    }

}
